import { ApiProperty } from '@nestjs/swagger';
import { Transform } from 'class-transformer';
import { IsNotEmpty, IsNumber, IsString, IsOptional } from 'class-validator';
import { queryDomain } from '@admin/common/domain/queryDomain';
/**@description 查询家谱BannerDto */
export class QueryJpBannerDto extends queryDomain {
  @ApiProperty({ description: '图片', required: false })
  @IsOptional()
  image: string | null;
  @ApiProperty({ description: '描述', required: false })
  @IsOptional()
  describe: string | null;
  @ApiProperty({ description: '状态(0禁用，1正常)', required: false })
  @IsOptional()
  status: string | null;
  @ApiProperty({ description: '排序', required: false })
  @IsOptional()
  @Transform(v => +v.value)
  @IsNumber()
  sort: number | null;
}
/**@description 创建家谱BannerDto */
export class CreateJpBannerDto {
  @ApiProperty({ description: '图片' })
  @IsNotEmpty({ message: '图片不能为空' })
  @IsString()
  image: string;
  @ApiProperty({ description: '描述' })
  @IsOptional()
  @IsString()
  describe?: string;
  @ApiProperty({ description: '状态(0禁用，1正常)' })
  @IsNotEmpty({ message: '状态(0禁用，1正常)不能为空' })
  @IsString()
  status: string;
  @ApiProperty({ description: '排序' })
  @IsNotEmpty({ message: '排序不能为空' })
  @Transform(v => +v.value)
  @IsNumber()
  sort: number;
  @ApiProperty({ description: '注册时间' })
  @IsOptional()
  @IsString()
  createTime?: string;
  @ApiProperty({ description: '修改时间' })
  @IsOptional()
  @IsString()
  updateTime?: string;
}
/**@description 更新家谱BannerDto */
export class UpdateJpBannerDto {
  @ApiProperty({ description: 'ID' })
  @IsNotEmpty({ message: 'ID不能为空' })
  @Transform(v => +v.value)
  @IsNumber()
  id: number;
  @ApiProperty({ description: '图片' })
  @IsNotEmpty({ message: '图片不能为空' })
  @IsString()
  image: string;
  @ApiProperty({ description: '描述' })
  @IsOptional()
  @IsString()
  describe?: string;
  @ApiProperty({ description: '状态(0禁用，1正常)' })
  @IsNotEmpty({ message: '状态(0禁用，1正常)不能为空' })
  @IsString()
  status: string;
  @ApiProperty({ description: '排序' })
  @IsNotEmpty({ message: '排序不能为空' })
  @Transform(v => +v.value)
  @IsNumber()
  sort: number;
}
